diff between const with static in rust

In Rust, const and static are both used to define constants. The difference between them is that const is a compile-time constant while static is a runtime constant1.

const is a value that can be computed at compile time and is stored wherever the constant is used2It has no fixed address in memory and is inlined to each place that uses it2.

On the other hand, a static variable means that the object’s lifetime is the entire execution of the program and its value is initialized only once before program startup1It has a fixed address in memory3 and can be changed at runtime4.